package com.runtu.types.design.framework.link.model2;

import com.runtu.types.design.framework.link.model2.chain.BusinessLinkedList;
import com.runtu.types.design.framework.link.model2.handler.ILogicHandler;

/**
 * @ClassName LinkArmory
 * @Description 链路的装配
 * @date 2025/8/7 16:59
 * @Version 1.0
 */
public class LinkArmory<T,D,R> {

    private  final BusinessLinkedList<T,D,R> logicLink;

    /*装备过程中，给一个链的名称linkName 和全部实现的logicHandlers*/
    @SafeVarargs
    public LinkArmory(String linkName, ILogicHandler<T, D, R>... logicHandlers) {
        logicLink=new BusinessLinkedList<>(linkName);
        for (ILogicHandler<T, D, R> logicHandler : logicHandlers) {
            logicLink.add(logicHandler);//装备好了之后添加到链路中去
        }
    }

    //最后返回这个链路 去执行自身的业务
    public BusinessLinkedList<T,D,R> getLogicLink() {return logicLink;}
}
